<?php
/**
 * @Author: xuzhiyi
 * @Date:   2016-02-16 20:57:18
 * @Last Modified by:   xuzhiyi
 * @Last Modified time: 2016-03-03 17:18:47
 * ------------------------------------------------ *
 * 文章分类                                         *
 * ------------------------------------------------ */

namespace Admin\Controller;
class ArticleCatsController extends CommonController {

	public function index() {
		if (IS_AJAX) {
			switch (I('ajax')) {
				case "catFlag":
					$status = D('ArticleCats')->editStatus();
					$this->ajaxReturn($status);
					break;

				case "addArticleCats":
					$a = D('ArticleCats')->addArticleCats();
					if ($a) {
						$this->success('分类添加成功！', '', true);
					}
					$this->error('分类添加失败！', '', true);
					break;
				case "delArticleCats":
					$status = D('ArticleCats')->delArticleCats();
					$this->ajaxReturn($status);
					break;
				case "editArticleCats":
					$a = D('ArticleCats')->editArticleCats();
					if ($a) {
						$this->success('分类修改成功！', '', true);
					}
					$this->error('分类修改失败！', '', true);
					break;
				default:
					$a      = D('ArticleCats');
					$output = $a->getArticleCats();
					$this->ajaxReturn($output);

			}
		}

		$this->display();
	}

}